<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>flex</title>

    <style>
        .flex{
            display: flex;
            width: 100vw;
            flex-wrap: wrap;
        }
        .flex-item{
            height: 20px;
            flex-basis: 31.3%;
            margin: 5px;
            background-color: greenyellow;
        }
    </style>
</head>
<body>

<div class="flex">
    <div class="flex-item"></div>
    <div class="flex-item"></div>
    <div class="flex-item"></div>
    <div class="flex-item"></div>
    <div class="flex-item"></div>
    <div class="flex-item"></div>
    <div class="flex-item"></div>
    <div class="flex-item"></div>
    <div class="flex-item"></div>
</div>

</body>
</html>